// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;
/**
 * 体力 加减
 */
@ccclass
export default class Power extends cc.Component {

    @property(cc.Label)
    powers: cc.Label = null;

    // LIFE-CYCLE CALLBACKS:
    //体力
    private _power = 0;

    // onLoad () {}

    start () {

    }

    updatePowersLabel(){
        let t_power = this._power;
        this.powers.string = `${t_power}`;
    }

    set power(powers: number){
        this._power = powers || 0;
        this.updatePowersLabel();
        // this.powers.string = `${powers}`;
    }

    get power() {
        return this._power;
    }

    // update (dt) {}
}
